﻿using Gtkj.CMS.App.Models;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace Gtkj.CMS.App
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("log4net.xml")));
           // string fileLogPath = Server.MapPath("/ExLog/");
            //WaitCallback
            //ThreadPool.QueueUserWorkItem((a) =>
            //{
            //    while (true)
            //    {
            //        if (MyExceptionAttribute.ExceptionQueue.Count > 0)
            //        {
            //            Exception ex = MyExceptionAttribute.ExceptionQueue.Dequeue();//出队
            //            ILog logger = LogManager.GetLogger("errorMsg");
            //            logger.Error(ex.ToString());
            //        }
            //        else
            //        {
            //            Thread.Sleep(3000);//如果队列中没有数据，休息避免造成CPU的空转.
            //        }
            //    }


            //}, fileLogPath);
        }
    }
}
